const routeBaseUrl = process.env.NODE_ENV === 'production' ? 'uiap/scrm/' : ''

export function genMaterialStream (type, key) {
  let method = ''
  switch (type) {
  case 'url':
    method = 'getUrlImage' // 微信服务器
    break
  case 'content':
    method = 'downloadFile'
    break
  case 'getTmpImage':
    method = 'getTmpImage' // 青云服务器
    break
  default:
    method = 'getTmpImage'
  }
  const queryKey = type === 'url' ? 'url' : 'key'
  return `${window.location.origin}/${routeBaseUrl}api/fin-scrm-adapt/file/${method}?${queryKey}=${key}`
}
